/* 
 * @description: // 添加其他选项数据
 * @author: Jane 
 * @date: 2023-09-20 15:03:23
 */
import 'package:basic_common/app_theme.dart';
import 'package:basic_common/common_exports.dart';
import 'package:basic_services/serviceDetail/service_detail_controller.dart';
import 'package:basic_widgets/button_widget.dart';
import 'package:basic_widgets/input_widget.dart';
class AddOtherDialog extends GetView<ServerDetailController> {
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: ScreenHelper.width(15)),
      child: SimpleDialog(
        title: const Align(
          alignment: Alignment.topCenter,
          child: Text("添加其他测量"),
        ),
        children: [
          Container(
            width: ScreenHelper.screenWidth,
            padding: EdgeInsets.symmetric(horizontal: ScreenHelper.width(15)),
            child: buildIntroWidget(),
          ),
          Container(
            alignment: Alignment.topCenter,
            padding: EdgeInsets.symmetric(horizontal: ScreenHelper.width(15)),
            child: buildEstimateWidget(),
          ),
          Obx(
            () => controller.otherImgUrl.value.isEmpty
                ? GestureDetector(
                    onTap: () {
                      controller.showSelectImg();
                    },
                    child: Align(
                      alignment: Alignment.centerLeft,
                      child: SizedBox(
                        width: ScreenHelper.width(80),
                        height: ScreenHelper.width(80),
                        child: Image.asset("assets/home/icon_add.png"),
                      ),
                    ),
                  )
                : Image.network(
                    controller.otherImgUrl.value,
                    width: ScreenHelper.width(80),
                    height: ScreenHelper.width(80),
                  ),
          ),
          Container(
            padding: EdgeInsets.symmetric(horizontal: ScreenHelper.width(15)),
            child: Row(
              children: [
                Expanded(
                    child: roundBtn(
                        onTap: () {
                          Get.back();
                        },
                        text: "取消",
                        bgColor: Colors.white,
                        textColor: AppTheme.primyColor,
                        borderColor: AppTheme.primyColor)),
                SizedBox(
                  width: ScreenHelper.width(10),
                ),
                Expanded(
                    child: roundBtn(
                        onTap: () {
                          Get.back();
                          controller.addOtherData();
                        },
                        text: "添加",
                        bgColor: AppTheme.primyColor,
                        textColor: Colors.white)),
              ],
            ),
          )
        ],
      ),
    );
  }

  /// 评估内容
  Widget buildEstimateWidget() {
    return Container(
      alignment: Alignment.topCenter,
      child: Row(
        mainAxisSize: MainAxisSize.min,
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          SizedBox(
            width: ScreenHelper.width(40),
            child: const Text(
              "评估",
              textAlign: TextAlign.left,
              style: TextStyle(color: AppTheme.dartWeakTextColor),
            ),
          ),
          Expanded(
            child: Container(
              alignment: Alignment.topCenter,
              child: mutileTextField(
                  hintText: "请输入评估内容",
                  textController: controller.otherElaController,
                  countNum: "",
                  minLines: 2),
            ),
          ),
        ],
      ),
    );
  }

  /// 测量说明内容
  Widget buildIntroWidget() {
    return Container(
      alignment: Alignment.topCenter,
      child: Row(
        mainAxisSize: MainAxisSize.min,
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          SizedBox(
            width: ScreenHelper.width(40),
            child: const Text(
              "测量说明",
              textAlign: TextAlign.left,
              style: TextStyle(color: AppTheme.dartWeakTextColor),
            ),
          ),
          Expanded(
            child: Container(
              alignment: Alignment.topCenter,
              child: mutileTextField(
                  hintText: "请输入测量说明",
                  textController: controller.OtherIntroController,
                  countNum: "",
                  minLines: 2),
            ),
          ),
        ],
      ),
    );
  }
}
